const mongoose = require("mongoose");

const ordersSchema = new mongoose.Schema({
    name:'',
    userId: {
        type: mongoose.Schema.Types.ObjectId,  
        ref: 'usersModel'
    } , // 订单所属⽤用户 id
    orderGoodsId: {
        type: mongoose.Schema.Types.ObjectId,  
        ref: 'orderGoodsModel'
    }, // 订单商品 id
    time: {type:Date,default:Date.now}, // 下单时间
    state: {type:Number,default:1}, // 订单状态{value:"待付款",num:1},{value:"待收货",num:2},{value:"待评价",num:3}
    dressId:{
        type: mongoose.Schema.Types.ObjectId,  
        ref: 'addressesModel'
    },
    totalprice:String,

    // shopsId:{
    //     type: mongoose.Schema.Types.ObjectId,    // 商店id
    //     ref: 'shopsModel'
    // },
    // goodId:{
    //     type: mongoose.Schema.Types.ObjectId,    // 所属订单的商品 id
    //     ref: 'goodsModel'
    // },
    // count: String, // 当前商品数量量
})

mongoose.model("ordersModel", ordersSchema, "orders");